package com.common.utils;

import org.springframework.stereotype.Component;

import java.time.Duration;
import java.time.LocalDateTime;

/**
 * @author liuxuhuang
 * @date 2023年04月20日 21:21
 * @desc
 */
@Component
public class TimeUtil {
    /**
     * 传入时间与现在时间进行比较
     *
     * @param dateTime
     * @return
     */
    public long comparableNowTime(LocalDateTime dateTime) {
        Duration between = Duration.between(LocalDateTime.now(), dateTime);
        return between.toNanos();
    }
}
